// pages/recipe-edit/nav/index.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
     dataSource: {
       type: Array,
       value: [],
       observer(data){
         this.setActived(data[data.length-1]?.id)
       }
     }
  },

  /**
   * 组件的初始数据
   */
  data: {
    actived: ''
  },

  /**
   * 组件的方法列表
   */
  methods: {
    onClick(event){
      const item = event.currentTarget.dataset.item;
      this.setActived(item.id);
      this.triggerEvent('change',item);
    },
    setActived(id){
 
       this.setData({
         actived: id
       })
    }
  }
})
